package com.yunsc.order.sevice;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yunsc.order.entity.YunscOrderEntity;
import com.yunsc.order.entity.YunscOrderGoodsEntity;
import com.yunsc.order.vo.CheckOrderGoodsVO;
import com.yunsc.order.vo.GoodsRankingVO;
import com.yunsc.order.vo.OrderGoodsVO;

import java.util.List;

/**
 * 订单商品记录表
 *
 * @author adan
 * @email 2028038953@qq.com
 * @date 2024-04-22 11:35:50
 */
public interface YunscOrderGoodsService extends IService<YunscOrderGoodsEntity> {

    /**
     * 根据订单商品ID查询订单商品信息
     * @param orderGoodsId 订单商品ID
     * @return 订单商品信息
     */
    OrderGoodsVO queryOrderGoodsById(Integer orderGoodsId);

    /**
     * 查询用户购买指定商品的数量
     * @param goodsId 订单ID
     * @param userId 用户ID
     * @return 订单商品数量
     */
    int queryUserOrderGoodsNum(Integer goodsId, Integer userId);

    /**
     * 保存订单商品信息到数据库
     *
     * @param userId      用户ID
     * @param orderEntity 订单实体
     * @param goodsList   订单商品列表
     * @param storeId
     */
    void saveOrderGoodsDb(Integer userId, YunscOrderEntity orderEntity, List<CheckOrderGoodsVO> goodsList, Integer storeId);

    /**
     * 根据订单ID查询订单商品列表
     * @param orderId 订单ID
     * @return 订单商品列表
     */
    List<YunscOrderGoodsEntity> queryOrderGoodsListByOrderId(Integer orderId);

    /**
     * 查询商品销量排行榜
     * @param storeId 店铺ID
     * @return 商品销量排行榜
     */
    List<GoodsRankingVO> queryGoodsRanking(Integer storeId);
}

